<include file="public@header" />
<style>
    .new-form-control{
        width: 49%;
        height: 34px;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #333333;
        background-color: #fff;
        background-image: none;
        /*border: 1px solid #ddd;*/
        border-radius: 4px;
    }
</style>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('task/addtask',['parentid'=>$Request.param.parentid])}">添加单人任务</a></li>
        <li  ><a href="{:url('task/taskList')}">我添加任务列表</a></li>
    </ul>
    <form method="post" id="form" class="form-horizontal js-ajax-form margin-top-20" action="{:url('task/addpost')}">
        <notempty name="$Request.param.parentid">
        <include file="task@taskdetail" />
        </notempty>


        <div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务名</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="input-user_login" name="task_title">
                <input type="hidden" class="form-control" id="input-" name="parentid" value="{$Request.param.parentid|default=0}">
            </div>
        </div>

        <!--<div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label">
                <span class="form-required"></span></label>
            <div class="col-md-6 col-sm-10">
               &nbsp;&nbsp;&nbsp;

            </div>
        </div>-->
        <div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务分类</label>
            <div class="col-md-6 col-sm-10">
                <input type="hidden" class="" value="0" name="task_multiplayer" >
                <select name="task_type">
                    <option value="其他">其他</option>
                    <option value="浏览类任务">浏览类任务</option>
                    <option value="分享类任务">分享类任务</option>
                    <option value="考试类任务">考试类任务</option>
                    <option value="视频类任务">视频类任务</option>
                    <option value="调研类任务">调研类任务</option>
                    <option value="业务动作类任务">业务动作类任务</option>
                    <option value="交叉洗客">交叉洗客</option>
                    <option value="十品十源_客源">十品十源_客源</option>
                </select>&nbsp;
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_login" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务接收者</label>
            <div class="col-md-6 col-sm-10">
                <input id="usernickname" class="new-form-control" name="" placeholder="输入姓名" style="border: 1px solid #ddd">
                <select class="new-form-control" ID="userlist" name="userid"  style="border: 1px solid #ddd">
                </select>
            </div>
        </div>

        <div class="form-group" id="" style="display: none">
            <label for="input-user_login" class="col-sm-2 control-label">
                标签</label>
            <div class="col-md-6 col-sm-10">
               <!-- <input type="text" class="form-control" id="" name="label">-->

            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                所属项目(非必选)
            </label>
            <div class="col-md-6 col-sm-10">
                <select class="form-control valid" name="task_project_id"  aria-invalid="false">
                    <option value="0">无</option>
                    <foreach name="project" item="vol">
                        <option value="{$vol.project_id}">{$vol.project_title}</option>
                    </foreach>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务文本内容
            </label>
            <div class="col-md-6 col-sm-10">
                <textarea class="form-control valid" id="input-site_seo_description" name="task_content" aria-invalid="false"></textarea>
            </div>

        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required"></span>任务示例图
            </label>
            <div class="new-form-control col-md-6 col-sm-10">
                <input id="photo-1" type="hidden" name="photo_url" >
                <input id="photo-1-name" type="text" title="图片名称" readonly>
                <img id="photo-1-preview" style="display: none;">
                <a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>优先级
            </label>
            <div class="col-md-6 col-sm-10">
                <select class="form-control valid" name="task_priority"  >
                    <option value="1">正常</option>
                    <option value="2">次要</option>
                    <option value="3" selected="">主要</option>
                    <option value="4" selected="">紧急</option>
                    <option value="5" selected="">严重</option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务计划开始时间
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control js-bootstrap-datetime"  name="task_start_time"
                       type="text"
                       id="input-birthday"
                       placeholder="2013-01-04 12:00:00" >
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务计划结束时间
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control js-bootstrap-datetime"  name="task_end_time"  placeholder="2013-01-04 12:00:00">
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                <span class="form-required">*</span>任务价值分
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="number" class="form-control "  name="task_mark"  placeholder="" >
            </div>
        </div>
        <div class="form-group">
            <label for="input-user_pass" class="col-sm-2 control-label">
                目标值
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="number" class="form-control "  name="target"  placeholder="" >
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>

    $('#usernickname').bind('input propertychange',function(){
        var name = $(this).val()
        if(name == ""){
            return
        }
        $.ajax({
            url:"{:Url('task/getUserByName')}",
            data:{
                name:name
            },
            type:'post',
            dataType:'json',
            success:function(xhr){
                var html =''
                var project= ''
                var  division = xhr.data
                for (x in division) {
                    html += '<option   value="'+division[x].id+'">'+division[x].user_login+'--'+division[x].user_nickname+'</option>'
                }
                $("#userlist").html(html)
                /* for (x in rule) {
                     project += '<option   value="'+rule[x].project+'">'+rule[x].project+'</option>'
                 }
                 $("#rule").html(project);*/
            }
        });
    })


</script>
</body>
</html>